﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataModel
{
    public class Gps
    {
        /// <summary>
        /// 被存储的数据库名
        /// </summary>
        public string DbName { get; set; }
        /// <summary>
        /// 被存储的表名
        /// </summary>
        public string TableName { get; set; }
        /// <summary>
        /// 设备号
        /// </summary>
        public string PhoneNum { get; set; }
        /// <summary>
        /// 报警标志位
        /// </summary>
        public Alarm TheAlarm { get; set; }
        /// <summary>
        /// 状态标志位
        /// </summary>
        public Status TheStatus { get; set; }

        public AttachData Attach { get; set; }
        /// <summary>
        /// 纬度，以度为单位的纬度值乘以10 的6 次方，精确到百万分之一度
        /// </summary>
        public double Latitude { get; set; }
        /// <summary>
        /// 经度，以度为单位的经度值乘以10 的6 次方，精确到百万分之一度
        /// </summary>
        public double Longitude { get; set; }
        /// <summary>
        /// 纠偏之后的经度
        /// </summary>
        public double PosX { get; set; }
        /// <summary>
        /// 纠偏之后的纬度
        /// </summary>
        public double PosY { get; set; }
        /// <summary>
        /// 区域信息
        /// </summary>
        public string RegionInfo { get; set; }
        /// <summary>
        /// 位置信息
        /// </summary>
        public string PlaceInfo { get; set; }
        /// <summary>
        /// gps速度 km/h
        /// </summary>
        public int Speed { get; set; }
        /// <summary>
        /// 方向，0-359，正北为0，顺时针
        /// </summary>
        public int Direction { get; set; }
        /// <summary>
        /// 时间，yyyy-MM-dd HH:mm:ss（GMT+8 时间，本标准中之后涉及的时间均采用此时区）
        /// </summary>
        public string SgpsTime { get; set; }
        /// <summary>
        /// GPS时间
        /// </summary>
        public DateTime GpsTime = DateTime.MinValue;
     
        /// <summary>
        /// 海拔高度，单位为m
        /// </summary>
        public int high { get; set; }

        /// <summary>
        /// 最后一次更新数据库时间
        /// </summary>
        public DateTime LastUpdateTime { get; set; }

        /// <summary>
        /// 车辆运行状态
        /// </summary>
        public string RunStatus { get; set; }

        /// <summary>
        /// 心跳时间
        /// </summary>
        public DateTime HeartTime = DateTime.MinValue;
      
        public bool IsBlind { get; set; }

        public int alarm { get; set; }

        public int status { get; set; }


        public string alarmDetail { get; set; }

        public string statusDetail { get; set; }

        public string deviceId { get; set; }




        public Gps()
        {

        }

        public Gps(BraceletLocation bracelet)
        {
            RegionInfo = "";
            Longitude=bracelet.longitude;
            Latitude= bracelet.latitude;
            PosX = bracelet.longitude;
            PosY = bracelet.latitude;
            PlaceInfo = bracelet.address;
            GpsTime = DateTime.Now;
            SgpsTime = GpsTime.ToString("yyyy-MM-dd HH:mm:ss");
            PhoneNum = bracelet.deviceid;
            Attach = new AttachData();
            TheStatus = new Status();
            TheAlarm = new Alarm();
        }

        //public double OilPercent { get; set; }
        //public override string ToString()
        //{
        //    return string.Format("设备号={0},纬度={1},经度={2},行驶记录速度={3}km/h,卫星定位速度={4}km/h,方向={5},时间={6},报警={7},状态={8},里程={9}km,油量={10}L,海拔高度={11}m,发动机转速={12}",
        //       PhoneNum, Latitude, Longitude, high, Speed/10.0, Direction, GpsTime, Alarm, Status, Mileage/10.0,OilNum/10.0,high,EngineSpeed );
        //}

    }
}
